//  导入vue核心包
import Vue from 'vue';

// 导入vue-router包提供路由服务
import VueRouter from 'vue-router';
// 在Vue中使用路由
Vue.use(VueRouter);
//导入mint-ui
import mintui from 'mint-ui';
//Vue中使用mint-ui
Vue.use(mintui);
//导入mint-ui样式  注意路径
import 'mint-ui/lib/style.min.css';
// 导入App.vue的vue对象
import App from './App.vue';
//导入其他.vue组件
import home from './components/home.vue';
import shopcar from './components/shopcar/shopcar.vue';
// 导入mui
import "../statics/mui/css/mui.css";
import "../statics/mui/css/iconfont.css"
import "../statics/css/site.css";


// 导入vue-resource
import vueResource from "vue-resource";
Vue.use(vueResource);
import newslist from "./components/news/newslist.vue";
import newsinfo from "./components/news/newsinfo.vue"
import photolist from "./components/photo/photolist.vue"
import photoinfo from "./components/photo/photoinfo.vue"
import moment from "moment";

Vue.filter('datefmt',function(input,fmtstring){
		return moment(input).format(fmtstring);
	});

	// 缩略图预览
import VuePreview from 'vue-preview'
Vue.use(VuePreview)


var router = new VueRouter({
	//mode:"history",
	linkActiveClass: "mui-active",
	routes:[
		{path:"/",redirect:"/home"},
		{path:"/home",component:home},
		{path:"/shopcar",component:shopcar},
		{path:"/news/newslist",component:newslist},
		{path:"/news/newsinfo/:id",component:newsinfo},
		{path:"/photo/photolist",component:photolist},
		{path:"/photo/photoinfo/:id",component:photoinfo}
	]
})

// 3.0 利用Vue对象进行解析渲染
new Vue({
	el:'#app',
	router,
	// render:function(create){create(App)} //es5的写法
	render:c=>c(App)  // es6的函数写法 =>：goes to
});